package com.qiyi.player.wonder.plugins.controllbar.view
{
   import com.iqiyi.components.panelSystem.impls.BasePanel;
   import com.qiyi.player.wonder.common.status.Status;
   import com.qiyi.player.wonder.common.vo.UserInfoVO;
   import com.qiyi.player.base.pub.EnumItem;
   import com.qiyi.player.wonder.plugins.controllbar.view.seekbar.SeekBarView;
   import com.qiyi.player.wonder.plugins.controllbar.view.volume.VolumeControlView;
   import controllbar.ControlBarUI;
   import flash.display.Shape;
   import com.iqiyi.components.tooltip.DefaultToolTip;
   import flash.display.SimpleButton;
   import flash.display.Sprite;
   import com.qiyi.player.core.model.def.DefinitionEnum;
   import flash.geom.Point;
   import com.iqiyi.components.global.GlobalStage;
   import com.qiyi.player.wonder.body.BodyDef;
   import gs.TweenLite;
   import com.qiyi.player.wonder.plugins.controllbar.ControllBarDef;
   import flash.display.DisplayObjectContainer;
   import com.qiyi.player.wonder.common.utils.ConstUtils;
   import com.qiyi.player.base.utils.Strings;
   import flash.events.MouseEvent;
   import com.iqiyi.components.tooltip.ToolTip;
   
   public class ControllBarView extends BasePanel
   {
      
      public function ControllBarView(param1:DisplayObjectContainer, param2:Status, param3:UserInfoVO) {
         super(NAME,param1);
         this._status = param2;
         this._userInfoVO = param3;
         this.initUI();
         this.onResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
      }
      
      public static const NAME:String = "com.qiyi.player.wonder.plugins.controllbar.view.ControllBarView";
      
      private var _status:Status;
      
      private var _userInfoVO:UserInfoVO;
      
      private var _currentDefinitionInfo:EnumItem;
      
      private var _seekBarView:SeekBarView;
      
      private var _volumeControlView:VolumeControlView;
      
      private var _controlBarUI:ControlBarUI;
      
      private var _cuePointShape:Shape;
      
      private var _tvListBtnClicked:Boolean = false;
      
      private var _loadingBtnToolTip:DefaultToolTip;
      
      public function get currentDefinitionInfo() : EnumItem {
         return this._currentDefinitionInfo;
      }
      
      public function set currentDefinitionInfo(param1:EnumItem) : void {
         this._currentDefinitionInfo = param1;
      }
      
      public function get seekBarView() : SeekBarView {
         return this._seekBarView;
      }
      
      public function get volumeControlView() : VolumeControlView {
         return this._volumeControlView;
      }
      
      public function get playBtn() : SimpleButton {
         return this._controlBarUI.triggerBtn.playBtn;
      }
      
      public function get pauseBtn() : SimpleButton {
         return this._controlBarUI.triggerBtn.pauseBtn;
      }
      
      public function get loadingBtn() : Sprite {
         return this._controlBarUI.loadingBtn;
      }
      
      public function get replayBtn() : SimpleButton {
         return this._controlBarUI.replayBtn;
      }
      
      public function get unFoldBtn() : SimpleButton {
         return this._controlBarUI.unFoldBtn;
      }
      
      public function get foldBtn() : SimpleButton {
         return this._controlBarUI.foldBtn;
      }
      
      public function get d2Btn() : SimpleButton {
         return this._controlBarUI.d2Btn;
      }
      
      public function get d3Btn() : SimpleButton {
         return this._controlBarUI.d3Btn;
      }
      
      public function get captionBtn() : SimpleButton {
         return this._controlBarUI.captionBtn;
      }
      
      public function get trackBtn() : SimpleButton {
         return this._controlBarUI.trackBtn;
      }
      
      public function get definitionQuickBtn() : SimpleButton {
         return this._controlBarUI.definitionQuickBtn;
      }
      
      public function get definitionEasyBtn() : SimpleButton {
         return this._controlBarUI.definitionEasyBtn;
      }
      
      public function get definitionHighBtn() : SimpleButton {
         return this._controlBarUI.definitionHighBtn;
      }
      
      public function get definitionSuperBtn() : SimpleButton {
         return this._controlBarUI.definitionSuperBtn;
      }
      
      public function get definition1080PBtn() : SimpleButton {
         return this._controlBarUI.definition1080PBtn;
      }
      
      public function get definitionFoutKBtn() : SimpleButton {
         return this._controlBarUI.definitionFoutKBtn;
      }
      
      public function get filterBtn() : SimpleButton {
         return this._controlBarUI.filterBtn;
      }
      
      public function get filterSeletedBtn() : SimpleButton {
         return this._controlBarUI.filterSeletedBtn;
      }
      
      public function get collectBtn() : SimpleButton {
         return this._controlBarUI.collectBtn;
      }
      
      public function get uncollectBtn() : SimpleButton {
         return this._controlBarUI.uncollectBtn;
      }
      
      public function setShowDefinitionBtnByType(param1:EnumItem) : void {
         if(param1 != null)
         {
            this._currentDefinitionInfo = param1;
         }
         this.definitionFoutKBtn.visible = this.definition1080PBtn.visible = this.definitionSuperBtn.visible = this.definitionHighBtn.visible = this.definitionEasyBtn.visible = this.definitionQuickBtn.visible = false;
         switch(param1)
         {
            case DefinitionEnum.FOUR_K:
               this.definitionFoutKBtn.visible = true;
               break;
            case DefinitionEnum.FULL_HD:
               this.definition1080PBtn.visible = true;
               break;
            case DefinitionEnum.SUPER_HIGH:
               this.definitionSuperBtn.visible = true;
               break;
            case DefinitionEnum.HIGH:
               this.definitionHighBtn.visible = true;
               break;
            case DefinitionEnum.STANDARD:
               this.definitionEasyBtn.visible = true;
               break;
            case DefinitionEnum.LIMIT:
               this.definitionQuickBtn.visible = true;
               break;
         }
      }
      
      public function set repeatSubBtnVisible(param1:Boolean) : void {
         this._controlBarUI.repeatBtn.openLoopBtn.visible = !param1;
         this._controlBarUI.repeatBtn.closeLoopBtn.visible = param1;
      }
      
      public function onUserInfoChanged(param1:UserInfoVO) : void {
         this._userInfoVO = param1;
      }
      
      public function onAddStatus(param1:int) : void {
         var _loc2_:* = 0;
         var _loc3_:Point = null;
         this._status.addStatus(param1);
         this.seekBarView.onAddStatus(param1);
         switch(param1)
         {
            case ControllBarDef.STATUS_OPEN:
               this.open();
               break;
            case ControllBarDef.STATUS_SHOW:
               _loc2_ = GlobalStage.stage.stageHeight - BodyDef.VIDEO_BOTTOM_RESERVE - 10;
               TweenLite.to(this,0.5,
                  {
                     "y":_loc2_,
                     "onComplete":this.onTweenComplete
                  });
               break;
            case ControllBarDef.STATUS_TRIGGER_BTN_SHOW:
               this._controlBarUI.triggerBtn.visible = true;
               this._controlBarUI.triggerBtn.pauseBtn.visible = true;
               this._controlBarUI.triggerBtn.playBtn.visible = false;
               this._controlBarUI.loadingBtn.visible = false;
               this._controlBarUI.replayBtn.visible = false;
               if(this._loadingBtnToolTip.parent)
               {
                  GlobalStage.stage.removeChild(this._loadingBtnToolTip);
               }
               break;
            case ControllBarDef.STATUS_TRIGGER_BTN_PAUSE:
               this._controlBarUI.triggerBtn.visible = true;
               this._controlBarUI.triggerBtn.pauseBtn.visible = false;
               this._controlBarUI.triggerBtn.playBtn.visible = true;
               this._controlBarUI.loadingBtn.visible = false;
               this._controlBarUI.replayBtn.visible = false;
               if(this._loadingBtnToolTip.parent)
               {
                  GlobalStage.stage.removeChild(this._loadingBtnToolTip);
               }
               break;
            case ControllBarDef.STATUS_LOAD_TIPS_SHOW:
               _loc3_ = localToGlobal(new Point(this._controlBarUI.triggerBtn.width / 3,-22));
               this._loadingBtnToolTip.x = _loc3_.x;
               this._loadingBtnToolTip.y = _loc3_.y;
               GlobalStage.stage.addChild(this._loadingBtnToolTip);
               break;
            case ControllBarDef.STATUS_LOAD_BTN_SHOW:
               this._controlBarUI.triggerBtn.visible = false;
               this._controlBarUI.loadingBtn.visible = true;
               this._controlBarUI.replayBtn.visible = false;
               break;
            case ControllBarDef.STATUS_REPLAY_BTN_SHOW:
               this._controlBarUI.triggerBtn.visible = false;
               this._controlBarUI.loadingBtn.visible = false;
               this._controlBarUI.replayBtn.visible = true;
               break;
            case ControllBarDef.STATUS_FULL_SCREEN_BTN_SHOW:
               if(GlobalStage.isFullScreen())
               {
                  this._controlBarUI.normalBtn.visible = true;
                  this._controlBarUI.fullscreenBtn.visible = false;
               }
               else
               {
                  this._controlBarUI.normalBtn.visible = false;
                  this._controlBarUI.fullscreenBtn.visible = true;
               }
               break;
            case ControllBarDef.STATUS_TIME_SHOW:
               this._controlBarUI.displayTime.visible = true;
               break;
            case ControllBarDef.STATUS_LOOP_PLAY_BTN_SHOW:
               this._controlBarUI.repeatBtn.visible = true;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_NEXT_BTN_SHOW:
               this._controlBarUI.nextVideoBtn.visible = true;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_LIST_BTN_SHOW:
               this._controlBarUI.tvListBtn.visible = this._status.hasStatus(ControllBarDef.STATUS_TVLIST_BTN_SHOW);
               this._controlBarUI.likeListBtn.visible = !this._controlBarUI.tvListBtn.visible;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_TVLIST_BTN_SHOW:
               this._controlBarUI.tvListBtn.visible = true;
               this._controlBarUI.likeListBtn.visible = false;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_EXPAND_BTN_SHOW:
               this._controlBarUI.unFoldBtn.visible = !this._status.hasStatus(ControllBarDef.STATUS_EXPAND_UNFOLD);
               this._controlBarUI.foldBtn.visible = this._status.hasStatus(ControllBarDef.STATUS_EXPAND_UNFOLD);
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_EXPAND_UNFOLD:
               if(this._status.hasStatus(ControllBarDef.STATUS_EXPAND_BTN_SHOW))
               {
                  this._controlBarUI.unFoldBtn.visible = !this._status.hasStatus(ControllBarDef.STATUS_EXPAND_UNFOLD);
                  this._controlBarUI.foldBtn.visible = this._status.hasStatus(ControllBarDef.STATUS_EXPAND_UNFOLD);
                  this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               }
               break;
            case ControllBarDef.STATUS_3D_BTN_SHOW:
               this._controlBarUI.d2Btn.visible = true;
               this._controlBarUI.d3Btn.visible = false;
               break;
            case ControllBarDef.STATUS_CAPTION_BTN_SHOW:
               this._controlBarUI.captionBtn.visible = true;
               break;
            case ControllBarDef.STATUS_TRACK_BTN_SHOW:
               this._controlBarUI.trackBtn.visible = true;
               break;
            case ControllBarDef.STATUS_DEFINITION_SHOW:
               this.setShowDefinitionBtnByType(this._currentDefinitionInfo);
               break;
            case ControllBarDef.STATUS_FILTER_BTN_SHOW:
               if(this._cuePointShape)
               {
                  this._cuePointShape.visible = true;
               }
               this._controlBarUI.filterBtn.visible = true;
               this._controlBarUI.filterSeletedBtn.visible = false;
               break;
            case ControllBarDef.STATUS_FILTER_OPEN:
               if((this._cuePointShape) && (this._cuePointShape.parent))
               {
                  this._cuePointShape.graphics.clear();
                  this._controlBarUI.removeChild(this._cuePointShape);
                  this._cuePointShape = null;
               }
               this._controlBarUI.filterBtn.visible = false;
               this._controlBarUI.filterSeletedBtn.visible = true;
               break;
            case ControllBarDef.STATUS_COLLECT_BTN_SHOW:
               this._controlBarUI.collectBtn.visible = true;
               this._controlBarUI.uncollectBtn.visible = false;
               break;
         }
      }
      
      public function onRemoveStatus(param1:int) : void {
         this._status.removeStatus(param1);
         this.seekBarView.onRemoveStatus(param1);
         switch(param1)
         {
            case ControllBarDef.STATUS_OPEN:
               this.close();
               break;
            case ControllBarDef.STATUS_SHOW:
               TweenLite.to(this,0.5,
                  {
                     "y":GlobalStage.stage.stageHeight,
                     "onComplete":this.onTweenComplete
                  });
               break;
            case ControllBarDef.STATUS_SEEK_BAR_SHOW:
               this.seekBarView.visible = false;
               break;
            case ControllBarDef.STATUS_FULL_SCREEN_BTN_SHOW:
               this._controlBarUI.normalBtn.visible = false;
               this._controlBarUI.fullscreenBtn.visible = false;
               break;
            case ControllBarDef.STATUS_TIME_SHOW:
               this._controlBarUI.displayTime.visible = false;
               break;
            case ControllBarDef.STATUS_LOOP_PLAY_BTN_SHOW:
               this._controlBarUI.repeatBtn.visible = false;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_NEXT_BTN_SHOW:
               this._controlBarUI.nextVideoBtn.visible = false;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_LIST_BTN_SHOW:
               this._controlBarUI.tvListBtn.visible = false;
               this._controlBarUI.likeListBtn.visible = false;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_TVLIST_BTN_SHOW:
               this._controlBarUI.tvListBtn.visible = false;
               this._controlBarUI.likeListBtn.visible = this._status.hasStatus(ControllBarDef.STATUS_LIST_BTN_SHOW);
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_EXPAND_BTN_SHOW:
               this._controlBarUI.unFoldBtn.visible = false;
               this._controlBarUI.foldBtn.visible = false;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_EXPAND_UNFOLD:
               if(this._status.hasStatus(ControllBarDef.STATUS_EXPAND_BTN_SHOW))
               {
                  this._controlBarUI.unFoldBtn.visible = !this._status.hasStatus(ControllBarDef.STATUS_EXPAND_UNFOLD);
                  this._controlBarUI.foldBtn.visible = this._status.hasStatus(ControllBarDef.STATUS_EXPAND_UNFOLD);
                  this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               }
               break;
            case ControllBarDef.STATUS_3D_BTN_SHOW:
               this._controlBarUI.d2Btn.visible = false;
               this._controlBarUI.d3Btn.visible = false;
               break;
            case ControllBarDef.STATUS_CAPTION_BTN_SHOW:
               this._controlBarUI.captionBtn.visible = false;
               break;
            case ControllBarDef.STATUS_TRACK_BTN_SHOW:
               this._controlBarUI.trackBtn.visible = false;
               break;
            case ControllBarDef.STATUS_DEFINITION_SHOW:
               this.setShowDefinitionBtnByType(null);
               break;
            case ControllBarDef.STATUS_LOAD_TIPS_SHOW:
               if(this._loadingBtnToolTip.parent)
               {
                  GlobalStage.stage.removeChild(this._loadingBtnToolTip);
               }
               break;
            case ControllBarDef.STATUS_FILTER_BTN_SHOW:
               if(this._cuePointShape)
               {
                  this._cuePointShape.visible = false;
               }
               this._controlBarUI.filterBtn.visible = this._controlBarUI.filterSeletedBtn.visible = false;
               this.onBtnsResize(GlobalStage.stage.stageWidth,GlobalStage.stage.stageHeight);
               break;
            case ControllBarDef.STATUS_FILTER_OPEN:
               this._controlBarUI.filterBtn.visible = true;
               this._controlBarUI.filterSeletedBtn.visible = false;
               break;
            case ControllBarDef.STATUS_COLLECT_BTN_SHOW:
               this._controlBarUI.collectBtn.visible = false;
               this._controlBarUI.uncollectBtn.visible = false;
               break;
         }
      }
      
      public function onResize(param1:int, param2:int) : void {
         var _loc3_:Point = null;
         x = 0;
         if(this._status.hasStatus(ControllBarDef.STATUS_SHOW))
         {
            y = GlobalStage.stage.stageHeight - BodyDef.VIDEO_BOTTOM_RESERVE - 10;
         }
         else
         {
            y = GlobalStage.stage.stageHeight;
         }
         this._controlBarUI.backGround.width = param1;
         if(this._status.hasStatus(ControllBarDef.STATUS_SEEK_BAR_SHOW))
         {
            this._seekBarView.onResize(param1,param2);
         }
         this._volumeControlView.y = 12;
         this.onBtnsResize(param1,param2);
         if(this._loadingBtnToolTip.parent)
         {
            _loc3_ = localToGlobal(new Point(this._controlBarUI.triggerBtn.width / 3,-22));
            this._loadingBtnToolTip.x = _loc3_.x;
            this._loadingBtnToolTip.y = _loc3_.y;
         }
      }
      
      private function onBtnsResize(param1:int, param2:int) : void {
         this._controlBarUI.repeatBtn.x = this._controlBarUI.triggerBtn.width + 1;
         this._controlBarUI.nextVideoBtn.x = this._controlBarUI.repeatBtn.x + this._controlBarUI.repeatBtn.width * int(this._controlBarUI.repeatBtn.visible);
         this._controlBarUI.tvListBtn.x = this._controlBarUI.nextVideoBtn.x + this._controlBarUI.nextVideoBtn.width * int(this._controlBarUI.nextVideoBtn.visible);
         this._controlBarUI.likeListBtn.x = this._controlBarUI.tvListBtn.x;
         this._controlBarUI.displayTime.x = 20 + this._controlBarUI.tvListBtn.x + (this._controlBarUI.tvListBtn.visible?this._controlBarUI.tvListBtn.width:this._controlBarUI.likeListBtn.width) * int(this._status.hasStatus(ControllBarDef.STATUS_LIST_BTN_SHOW));
         this._controlBarUI.fullscreenBtn.x = param1 - this._controlBarUI.fullscreenBtn.width - 2;
         this._controlBarUI.normalBtn.x = this._controlBarUI.fullscreenBtn.x;
         this._controlBarUI.unFoldBtn.x = this._controlBarUI.normalBtn.x - this._controlBarUI.unFoldBtn.width * int(this._status.hasStatus(ControllBarDef.STATUS_EXPAND_BTN_SHOW));
         this._controlBarUI.foldBtn.x = this._controlBarUI.unFoldBtn.x;
         var _loc3_:Boolean = this._status.hasStatus(ControllBarDef.STATUS_VOLUME_BAR_SHOW);
         this._volumeControlView.x = this._controlBarUI.unFoldBtn.x - this._volumeControlView.width * int(_loc3_) - 16;
         this.definitionFoutKBtn.x = this.definition1080PBtn.x = this.definitionSuperBtn.x = this.definitionHighBtn.x = this.definitionEasyBtn.x = this.definitionQuickBtn.x = this._volumeControlView.x - this._controlBarUI.definition1080PBtn.width * int(this._status.hasStatus(ControllBarDef.STATUS_DEFINITION_SHOW));
         this._controlBarUI.uncollectBtn.x = this._controlBarUI.collectBtn.x = this._controlBarUI.definition1080PBtn.x - this._controlBarUI.uncollectBtn.width * (int(this._controlBarUI.uncollectBtn.visible) + int(this._controlBarUI.collectBtn.visible));
         this._controlBarUI.filterSeletedBtn.x = this._controlBarUI.filterBtn.x = this._controlBarUI.uncollectBtn.x - this._controlBarUI.filterBtn.width * (int(this._controlBarUI.filterBtn.visible) + int(this._controlBarUI.filterSeletedBtn.visible));
         this._controlBarUI.trackBtn.x = this._controlBarUI.filterBtn.x - this._controlBarUI.trackBtn.width * int(this._controlBarUI.trackBtn.visible);
         this._controlBarUI.captionBtn.x = this._controlBarUI.trackBtn.x - this._controlBarUI.captionBtn.width * int(this._controlBarUI.captionBtn.visible);
         this._controlBarUI.d2Btn.x = this._controlBarUI.captionBtn.x - this._controlBarUI.d2Btn.width * int(this._controlBarUI.d2Btn.visible);
         this._controlBarUI.d3Btn.x = this._controlBarUI.captionBtn.x - this._controlBarUI.d2Btn.width * int(this._controlBarUI.d3Btn.visible);
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_DefinitionBtnLocationChange,
            {
               "x":this.definition1080PBtn.x,
               "cx":this.collectBtn.x,
               "y":this.y
            }));
         if(this._cuePointShape)
         {
            this._cuePointShape.x = this._controlBarUI.filterSeletedBtn.x;
         }
         if(this._status.hasStatus(ControllBarDef.STATUS_PREVIEW_VIDEO_SHOW))
         {
            dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_PreviewVedioPosChange,this._seekBarView.localToGlobal(new Point(this._seekBarView.previewTip.x,0)).x));
         }
      }
      
      public function onPlayerRunning(param1:int, param2:int, param3:int, param4:Boolean) : void {
         this._seekBarView.onPlayerRunning(param1,param2,param4);
         this.updateDisplayTime(param3,param1);
      }
      
      public function adjustDisplayTimeOnStoped() : void {
         var _loc1_:int = this._seekBarView.totalTime - this._seekBarView.currentTime;
         if(_loc1_ <= 2000 && !(_loc1_ == 0))
         {
            this.updateDisplayTime(this._seekBarView.totalTime,this._seekBarView.totalTime);
         }
      }
      
      public function updateD3BtnVisible(param1:Boolean) : void {
         this._controlBarUI.d3Btn.visible = param1;
         this._controlBarUI.d2Btn.visible = !param1;
      }
      
      public function updateCollectBtnState(param1:Boolean) : void {
         this._controlBarUI.collectBtn.visible = !param1;
         this._controlBarUI.uncollectBtn.visible = param1;
      }
      
      override public function open(param1:DisplayObjectContainer = null) : void {
         if(!isOnStage)
         {
            super.open(param1);
            dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_Open));
         }
      }
      
      override public function close() : void {
         if(isOnStage)
         {
            super.close();
            dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_Close));
         }
      }
      
      override protected function onAddToStage() : void {
         super.onAddToStage();
      }
      
      override protected function onRemoveFromStage() : void {
         super.onRemoveFromStage();
      }
      
      private function updateDisplayTime(param1:int, param2:int) : void {
         var _loc3_:* = "";
         var _loc4_:* = "";
         if(param1 > ConstUtils.H_2_MS)
         {
            _loc3_ = Strings.formatAsTimeCode(param2 / 1000,true);
            _loc4_ = Strings.formatAsTimeCode(param1 / 1000,true);
         }
         else
         {
            _loc3_ = Strings.formatAsTimeCode(param2 / 1000,false);
            _loc4_ = Strings.formatAsTimeCode(param1 / 1000,false);
         }
         this._controlBarUI.displayTime.text = _loc3_ + "/" + _loc4_;
      }
      
      private function onNormalScreenBtnClick(param1:MouseEvent) : void {
         GlobalStage.setNormalScreen();
         this._controlBarUI.normalBtn.visible = false;
         this._controlBarUI.fullscreenBtn.visible = true;
      }
      
      private function onFullScreenBtnClick(param1:MouseEvent) : void {
         GlobalStage.setFullScreen();
         this._controlBarUI.normalBtn.visible = true;
         this._controlBarUI.fullscreenBtn.visible = false;
      }
      
      private function onRepeatBtnClick(param1:MouseEvent) : void {
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_RepeatBtnClicked,this._controlBarUI.repeatBtn.openLoopBtn.visible));
      }
      
      private function onNextVideoBtnClick(param1:MouseEvent) : void {
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_NextVideoBtnClicked));
      }
      
      private function onTvListBtnClick(param1:MouseEvent) : void {
         this._tvListBtnClicked = !this._tvListBtnClicked;
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_TvListBtnClicked,this._tvListBtnClicked));
      }
      
      private function onDefinitionBtnClick(param1:MouseEvent) : void {
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_DefinitionBtnClicked));
      }
      
      private function onTweenComplete() : void {
         if(this._status.hasStatus(ControllBarDef.STATUS_SHOW))
         {
            y = GlobalStage.stage.stageHeight - BodyDef.VIDEO_BOTTOM_RESERVE - 10;
         }
         else
         {
            y = GlobalStage.stage.stageHeight;
         }
         dispatchEvent(new ControllBarEvent(ControllBarEvent.Evt_DefinitionBtnLocationChange,
            {
               "x":this.definition1080PBtn.x,
               "cx":this.collectBtn.x,
               "y":this.y
            }));
      }
      
      private function initUI() : void {
         this._seekBarView = new SeekBarView(this._status);
         this._seekBarView.visible = false;
         this._seekBarView.y = 1;
         this._loadingBtnToolTip = new DefaultToolTip();
         this._loadingBtnToolTip.text = "正在缓冲...";
         this._volumeControlView = new VolumeControlView(this._status);
         this._controlBarUI = new ControlBarUI();
         this._controlBarUI.x = 0;
         this._controlBarUI.y = 10;
         this._cuePointShape = new Shape();
         this._cuePointShape.graphics.beginFill(15817252);
         this._cuePointShape.graphics.drawCircle(39,12,4);
         this._cuePointShape.graphics.endFill();
         this._controlBarUI.triggerBtn.playBtn.visible = false;
         this._controlBarUI.loadingBtn.visible = false;
         this._controlBarUI.loadingBtn.mouseChildren = false;
         this._controlBarUI.loadingBtn.buttonMode = true;
         this._controlBarUI.loadingBtn.useHandCursor = true;
         this._controlBarUI.loadingBtn.graphics.beginFill(0,0);
         this._controlBarUI.loadingBtn.graphics.drawRect(-this._controlBarUI.loadingBtn.width / 2,-this._controlBarUI.loadingBtn.height / 2,this._controlBarUI.loadingBtn.width,this._controlBarUI.loadingBtn.height);
         this._controlBarUI.loadingBtn.graphics.endFill();
         this._controlBarUI.replayBtn.visible = false;
         this._controlBarUI.normalBtn.visible = false;
         this._controlBarUI.normalBtn.addEventListener(MouseEvent.CLICK,this.onNormalScreenBtnClick);
         this._controlBarUI.fullscreenBtn.visible = true;
         this._controlBarUI.fullscreenBtn.addEventListener(MouseEvent.CLICK,this.onFullScreenBtnClick);
         this._controlBarUI.repeatBtn.addEventListener(MouseEvent.CLICK,this.onRepeatBtnClick);
         this._controlBarUI.nextVideoBtn.addEventListener(MouseEvent.CLICK,this.onNextVideoBtnClick);
         this._controlBarUI.tvListBtn.addEventListener(MouseEvent.CLICK,this.onTvListBtnClick);
         this._controlBarUI.likeListBtn.addEventListener(MouseEvent.CLICK,this.onTvListBtnClick);
         this.definitionFoutKBtn.addEventListener(MouseEvent.CLICK,this.onDefinitionBtnClick);
         this.definition1080PBtn.addEventListener(MouseEvent.CLICK,this.onDefinitionBtnClick);
         this.definitionEasyBtn.addEventListener(MouseEvent.CLICK,this.onDefinitionBtnClick);
         this.definitionHighBtn.addEventListener(MouseEvent.CLICK,this.onDefinitionBtnClick);
         this.definitionQuickBtn.addEventListener(MouseEvent.CLICK,this.onDefinitionBtnClick);
         this.definitionSuperBtn.addEventListener(MouseEvent.CLICK,this.onDefinitionBtnClick);
         this._controlBarUI.repeatBtn.visible = false;
         this._controlBarUI.repeatBtn.openLoopBtn.visible = true;
         this._controlBarUI.repeatBtn.closeLoopBtn.visible = false;
         this._controlBarUI.nextVideoBtn.visible = false;
         this._controlBarUI.tvListBtn.visible = false;
         this._controlBarUI.likeListBtn.visible = false;
         this._controlBarUI.displayTime.visible = false;
         this._controlBarUI.unFoldBtn.visible = false;
         this._controlBarUI.foldBtn.visible = false;
         this._controlBarUI.d2Btn.visible = false;
         this._controlBarUI.d3Btn.visible = false;
         this._controlBarUI.captionBtn.visible = false;
         this._controlBarUI.trackBtn.visible = false;
         this._controlBarUI.filterBtn.visible = false;
         this._controlBarUI.filterSeletedBtn.visible = false;
         this._controlBarUI.collectBtn.visible = false;
         this._controlBarUI.uncollectBtn.visible = false;
         this._cuePointShape.visible = false;
         this.setShowDefinitionBtnByType(null);
         addChild(this._seekBarView);
         addChild(this._controlBarUI);
         addChild(this._volumeControlView);
         this._controlBarUI.addChild(this._cuePointShape);
         this.registerToolTip();
      }
      
      private function registerToolTip() : void {
         ToolTip.getInstance().registerComponent(this._seekBarView.forWardBtn,"快进");
         ToolTip.getInstance().registerComponent(this._seekBarView.backWardBtn,"快退");
         ToolTip.getInstance().registerComponent(this._controlBarUI.triggerBtn.playBtn,"点击播放");
         ToolTip.getInstance().registerComponent(this._controlBarUI.triggerBtn.pauseBtn,"点击暂停");
         ToolTip.getInstance().registerComponent(this._controlBarUI.replayBtn,"重新播放");
         ToolTip.getInstance().registerComponent(this._controlBarUI.nextVideoBtn,"下一集");
         ToolTip.getInstance().registerComponent(this._controlBarUI.likeListBtn,"播放列表");
         ToolTip.getInstance().registerComponent(this._controlBarUI.tvListBtn,"剧集列表");
         ToolTip.getInstance().registerComponent(this._controlBarUI.repeatBtn.openLoopBtn,"开启循环");
         ToolTip.getInstance().registerComponent(this._controlBarUI.repeatBtn.closeLoopBtn,"关闭循环");
         ToolTip.getInstance().registerComponent(this._controlBarUI.unFoldBtn,"展开");
         ToolTip.getInstance().registerComponent(this._controlBarUI.foldBtn,"收起");
         ToolTip.getInstance().registerComponent(this._controlBarUI.d2Btn,"切换至3D");
         ToolTip.getInstance().registerComponent(this._controlBarUI.d3Btn,"切换至2D");
         ToolTip.getInstance().registerComponent(this._controlBarUI.captionBtn,"设置字幕");
         ToolTip.getInstance().registerComponent(this._controlBarUI.trackBtn,"设置配音");
         ToolTip.getInstance().registerComponent(this._volumeControlView.speaker,"静音设置");
         ToolTip.getInstance().registerComponent(this._controlBarUI.normalBtn,"退出全屏");
         ToolTip.getInstance().registerComponent(this._controlBarUI.fullscreenBtn,"全屏");
         ToolTip.getInstance().registerComponent(this._controlBarUI.filterBtn,"开启精彩模式");
         ToolTip.getInstance().registerComponent(this._controlBarUI.filterSeletedBtn,"关闭绿镜");
         ToolTip.getInstance().registerComponent(this._controlBarUI.collectBtn,"收藏");
         ToolTip.getInstance().registerComponent(this._controlBarUI.uncollectBtn,"取消收藏");
      }
   }
}
